// Bachelor of Software Engineering 
// Media Design School 
// Auckland
// New Zealand
// 
// (c) 2005 - 2014 Media Design School 
// 
// File Name : CardPileGroup.h
// Description : CardPileGroup header
// Author : Serge Radinovich
// Mail : srad015@hotmail.com


#pragma once
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <stack>
#include "Card.h"


class Move;			//For recording moves made by player

//Base class of Tableau, Foundation and Stock (including waste)
class CardPileGroup
{
	
protected:
	//Vector of pointers to lists of pointers to cards
	std::vector<std::list<Card*>*> m_Stacks;		//All card stacks in the PileGroup (Stock has 2, Tableau 7, Foundation 4)
	std::vector<GameObject> m_NullSpaces;			//Locations to draw empty spaces where cards pile on top of
	HDC m_hNullSpaceDC;								//DC for bitmap drawn on null space

	bool CheckCollision(Vector2 _MouseClickPos, GameObject* _Card, bool _bFrontCard = true);
	bool CheckCollision(GameObject* _pCard1, GameObject* _pCard2);
	
	static void Animate(std::list<Card*>* _pCardList, Vector2 _Dest);

public:

	CardPileGroup(void);
	virtual ~CardPileGroup(void);


	std::vector<std::list<Card*>*> GetStacks();

	void SetNullSpaceDC(HDC _hNullDC);

	virtual bool IsEmpty() const;
	int GetCardCount() const;
	
	//Pure virtuals
	virtual void Draw() = 0;
	virtual bool AttemptCardDeposit(Vector2 _clickPos, std::list<Card*>* _pGrabbedCards, std::list<Card*>* &_pListDepositedTo) = 0;
	virtual std::list<Card*>* AttemptCardGrab(Vector2 _clickPos, std::list<Card*>* grabbedCards) = 0;
	virtual void UndoMove(Move* _move) = 0;
};

